package com.fxu.role.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fxu.framework.core.enums.EnumValid;
import com.fxu.framework.core.enums.ShowStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

import static com.baomidou.mybatisplus.annotation.FieldFill.*;

/***
 * <p>fxu</p>
 * 系统配置表：[conf]的数据实体类
 * @author fangxu
 * @version 2021-04-11
 ***/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "Conf", description = "系统配置")
@TableName("fxu_conf")
public class Conf implements Serializable {
/*=== 自动生成代码 开始 ===*/
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "自增ID[支持普通搜索]")
    private Long id;

    @ApiModelProperty(value = "类型", required = true)
    private String type;

    @ApiModelProperty(value = "名称", required = true)
    private String name;

    @ApiModelProperty(value = "配置值", required = true)
    private String value;

    @ApiModelProperty(value = "排序")
    private Integer orderNo;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "状态[1:正常,0:删除,2:隐藏]")
    @EnumValid(target = ShowStatus.class, message = "状态的值必须为{1:正常,0:删除,2:隐藏}")
    private Integer status;

    @TableField(fill = INSERT_UPDATE, update = "%s+1")
    @ApiModelProperty(value = "版本号")
    private Integer version;

    /**
     * 获得状态的说明
     * @return 状态说明
     */
    public String getStatusText() {
        return ShowStatus.desc(status);
    }
/*=== 自动生成代码 结束 ===*/
}
